package org.sbbs.base.utils;

import java.util.Date;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public class TestTimer {
	protected static final Log log = LogFactory.getLog(TestTimer.class);
	private String testName;
	private Date begin;
	private Date end;

	public TestTimer(String testName) {
		this.testName = testName;
	}

	public void begin() {
		begin = new Date();
	}

	public void done() {
		end = new Date();
		this.showResult();
	}

	private void showResult() {
		long msTime = end.getTime() - begin.getTime();
		// System.out.println(testName+" use time: " + msTime + "ms");
		log.debug(testName + " use time: " + msTime + "ms");
	}

}
